package com.zxp.dubbo.consumer;

import com.zxp.client.User;
import com.zxp.client.UserService;
import lombok.SneakyThrows;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * @author zxp
 * @date 2021-08-24 15:29
 */
public class SpringConsummer {
    @SneakyThrows
    public static void main(String[] args) {
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("dubbo-consummer.xml");
        UserService userService = applicationContext.getBean(UserService.class);
        User user = userService.getUser(1);
        System.out.println(user);

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        while (true) {

            String line = reader.readLine();
            if (line.equals("quit")) {
                break;
            }
            System.out.println(userService.getUser(1));
        }
    }
}
